1 /* 2 3 Boost Software License - Version 1.0 - August 17th, 2003 4 5 Permission is hereby granted, free of charge, to any person or organization 6 obtaining a copy of the software and accompanying documentation covered by 7 this license (the "Software") to use, reproduce, display, distribute, 8 execute, and transmit the Software, and to prepare derivative works of the 9 Software, and to permit third-parties to whom the Software is furnished to 10 do so, all subject to the following: 11 12 The copyright notices in the Software and this entire statement, including 13 the above license grant, this restriction and the following disclaimer, 14 must be included in all copies of the Software, in whole or in part, and 15 all derivative works of the Software, unless such copies or derivative 16 works are solely in the form of machine-executable object code generated by 17 a source language processor. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 DEALINGS IN THE SOFTWARE. 26 27 */ 28 29 module derelict.glib.gregex; 30 31 import derelict.glib.gtypes; 32 import derelict.glib.glibconfig; 33 import derelict.glib.gstring; 34 import derelict.glib.gerror; 35 import derelict.glib.gquark; 36 import core.stdc.string; 37 import core.stdc.config; 38 39 extern (C): 40 41 alias _Anonymous_0 GRegexError; 42 alias _Anonymous_1 GRegexCompileFlags; 43 alias _Anonymous_2 GRegexMatchFlags; 44 alias _GRegex GRegex; 45 alias _GMatchInfo GMatchInfo; 46 alias int function (const(_GMatchInfo)*, _GString*, void*) GRegexEvalCallback; 47 48 enum _Anonymous_0 49 { 50 G_REGEX_ERROR_COMPILE = 0, 51 G_REGEX_ERROR_OPTIMIZE = 1, 52 G_REGEX_ERROR_REPLACE = 2, 53 G_REGEX_ERROR_MATCH = 3, 54 G_REGEX_ERROR_INTERNAL = 4, 55 G_REGEX_ERROR_STRAY_BACKSLASH = 101, 56 G_REGEX_ERROR_MISSING_CONTROL_CHAR = 102, 57 G_REGEX_ERROR_UNRECOGNIZED_ESCAPE = 103, 58 G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER = 104, 59 G_REGEX_ERROR_QUANTIFIER_TOO_BIG = 105, 60 G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS = 106, 61 G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS = 107, 62 G_REGEX_ERROR_RANGE_OUT_OF_ORDER = 108, 63 G_REGEX_ERROR_NOTHING_TO_REPEAT = 109, 64 G_REGEX_ERROR_UNRECOGNIZED_CHARACTER = 112, 65 G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS = 113, 66 G_REGEX_ERROR_UNMATCHED_PARENTHESIS = 114, 67 G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE = 115, 68 G_REGEX_ERROR_UNTERMINATED_COMMENT = 118, 69 G_REGEX_ERROR_EXPRESSION_TOO_LARGE = 120, 70 G_REGEX_ERROR_MEMORY_ERROR = 121, 71 G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND = 125, 72 G_REGEX_ERROR_MALFORMED_CONDITION = 126, 73 G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES = 127, 74 G_REGEX_ERROR_ASSERTION_EXPECTED = 128, 75 G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME = 130, 76 G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED = 131, 77 G_REGEX_ERROR_HEX_CODE_TOO_LARGE = 134, 78 G_REGEX_ERROR_INVALID_CONDITION = 135, 79 G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND = 136, 80 G_REGEX_ERROR_INFINITE_LOOP = 140, 81 G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR = 142, 82 G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME = 143, 83 G_REGEX_ERROR_MALFORMED_PROPERTY = 146, 84 G_REGEX_ERROR_UNKNOWN_PROPERTY = 147, 85 G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG = 148, 86 G_REGEX_ERROR_TOO_MANY_SUBPATTERNS = 149, 87 G_REGEX_ERROR_INVALID_OCTAL_VALUE = 151, 88 G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE = 154, 89 G_REGEX_ERROR_DEFINE_REPETION = 155, 90 G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS = 156, 91 G_REGEX_ERROR_MISSING_BACK_REFERENCE = 157 92 } 93 94 enum _Anonymous_1 95 { 96 G_REGEX_CASELESS = 1, 97 G_REGEX_MULTILINE = 2, 98 G_REGEX_DOTALL = 4, 99 G_REGEX_EXTENDED = 8, 100 G_REGEX_ANCHORED = 16, 101 G_REGEX_DOLLAR_ENDONLY = 32, 102 G_REGEX_UNGREEDY = 512, 103 G_REGEX_RAW = 2048, 104 G_REGEX_NO_AUTO_CAPTURE = 4096, 105 G_REGEX_OPTIMIZE = 8192, 106 G_REGEX_DUPNAMES = 524288, 107 G_REGEX_NEWLINE_CR = 1048576, 108 G_REGEX_NEWLINE_LF = 2097152, 109 G_REGEX_NEWLINE_CRLF = 3145728 110 } 111 112 enum _Anonymous_2 113 { 114 G_REGEX_MATCH_ANCHORED = 16, 115 G_REGEX_MATCH_NOTBOL = 128, 116 G_REGEX_MATCH_NOTEOL = 256, 117 G_REGEX_MATCH_NOTEMPTY = 1024, 118 G_REGEX_MATCH_PARTIAL = 32768, 119 G_REGEX_MATCH_NEWLINE_CR = 1048576, 120 G_REGEX_MATCH_NEWLINE_LF = 2097152, 121 G_REGEX_MATCH_NEWLINE_CRLF = 3145728, 122 G_REGEX_MATCH_NEWLINE_ANY = 4194304 123 } 124 125 struct _GRegex; 126 127 128 struct _GMatchInfo; 129 130 version(Derelict_Link_Static) 131 { 132 extern( C ) nothrow 133 { 134 GQuark g_regex_error_quark(); 135 GRegex* g_regex_new(const(gchar)* pattern, GRegexCompileFlags compile_options, GRegexMatchFlags match_options, GError** error); 136 GRegex* g_regex_ref(GRegex* regex); 137 void g_regex_unref(GRegex* regex); 138 const(gchar)* g_regex_get_pattern(const(GRegex)* regex); 139 gint g_regex_get_max_backref(const(GRegex)* regex); 140 gint g_regex_get_capture_count(const(GRegex)* regex); 141 gboolean g_regex_get_has_cr_or_lf(const GRegex *regex); 142 gint g_regex_get_string_number(const(GRegex)* regex, const(gchar)* name); 143 gchar* g_regex_escape_string(const(gchar)* string, gint length); 144 gchar* g_regex_escape_nul(const(gchar)* string, gint length); 145 GRegexCompileFlags g_regex_get_compile_flags(const(GRegex)* regex); 146 GRegexMatchFlags g_regex_get_match_flags(const(GRegex)* regex); 147 gboolean g_regex_match_simple(const(gchar)* pattern, const(gchar)* string, GRegexCompileFlags compile_options, GRegexMatchFlags match_options); 148 gboolean g_regex_match(const(GRegex)* regex, const(gchar)* string, GRegexMatchFlags match_options, GMatchInfo** match_info); 149 gboolean g_regex_match_full(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, GMatchInfo** match_info, GError** error); 150 gboolean g_regex_match_all(const(GRegex)* regex, const(gchar)* string, GRegexMatchFlags match_options, GMatchInfo** match_info); 151 gboolean g_regex_match_all_full(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, GMatchInfo** match_info, GError** error); 152 gchar** g_regex_split_simple(const(gchar)* pattern, const(gchar)* string, GRegexCompileFlags compile_options, GRegexMatchFlags match_options); 153 gchar** g_regex_split(const(GRegex)* regex, const(gchar)* string, GRegexMatchFlags match_options); 154 gchar** g_regex_split_full(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, gint max_tokens, GError** error); 155 gchar* g_regex_replace(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, const(gchar)* replacement, GRegexMatchFlags match_options, GError** error); 156 gchar* g_regex_replace_literal(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, const(gchar)* replacement, GRegexMatchFlags match_options, GError** error); 157 gchar* g_regex_replace_eval(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, GRegexEvalCallback eval, gpointer user_data, GError** error); 158 gboolean g_regex_check_replacement(const(gchar)* replacement, gboolean* has_references, GError** error); 159 GRegex* g_match_info_get_regex(const(GMatchInfo)* match_info); 160 const(gchar)* g_match_info_get_string(const(GMatchInfo)* match_info); 161 GMatchInfo* g_match_info_ref(GMatchInfo* match_info); 162 void g_match_info_unref(GMatchInfo* match_info); 163 void g_match_info_free(GMatchInfo* match_info); 164 gboolean g_match_info_next(GMatchInfo* match_info, GError** error); 165 gboolean g_match_info_matches(const(GMatchInfo)* match_info); 166 gint g_match_info_get_match_count(const(GMatchInfo)* match_info); 167 gboolean g_match_info_is_partial_match(const(GMatchInfo)* match_info); 168 gchar* g_match_info_expand_references(const(GMatchInfo)* match_info, const(gchar)* string_to_expand, GError** error); 169 gchar* g_match_info_fetch(const(GMatchInfo)* match_info, gint match_num); 170 gboolean g_match_info_fetch_pos(const(GMatchInfo)* match_info, gint match_num, gint* start_pos, gint* end_pos); 171 gchar* g_match_info_fetch_named(const(GMatchInfo)* match_info, const(gchar)* name); 172 gboolean g_match_info_fetch_named_pos(const(GMatchInfo)* match_info, const(gchar)* name, gint* start_pos, gint* end_pos); 173 gchar** g_match_info_fetch_all(const(GMatchInfo)* match_info); 174 } 175 } 176 else 177 { 178 extern( C ) nothrow 179 { 180 alias da_g_regex_error_quark = GQuark function(); 181 alias da_g_regex_new = GRegex* function(const(gchar)* pattern, GRegexCompileFlags compile_options, GRegexMatchFlags match_options, GError** error); 182 alias da_g_regex_ref = GRegex* function(GRegex* regex); 183 alias da_g_regex_unref = void function(GRegex* regex); 184 alias da_g_regex_get_pattern = const(gchar)* function(const(GRegex)* regex); 185 alias da_g_regex_get_max_backref = gint function(const(GRegex)* regex); 186 alias da_g_regex_get_capture_count = gint function(const(GRegex)* regex); 187 alias da_g_regex_get_has_cr_or_lf = gboolean function(const GRegex *regex); 188 alias da_g_regex_get_string_number = gint function(const(GRegex)* regex, const(gchar)* name); 189 alias da_g_regex_escape_string = gchar* function(const(gchar)* string, gint length); 190 alias da_g_regex_escape_nul = gchar* function(const(gchar)* string, gint length); 191 alias da_g_regex_get_compile_flags = GRegexCompileFlags function(const(GRegex)* regex); 192 alias da_g_regex_get_match_flags = GRegexMatchFlags function(const(GRegex)* regex); 193 alias da_g_regex_match_simple = gboolean function(const(gchar)* pattern, const(gchar)* string, GRegexCompileFlags compile_options, GRegexMatchFlags match_options); 194 alias da_g_regex_match = gboolean function(const(GRegex)* regex, const(gchar)* string, GRegexMatchFlags match_options, GMatchInfo** match_info); 195 alias da_g_regex_match_full = gboolean function(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, GMatchInfo** match_info, GError** error); 196 alias da_g_regex_match_all = gboolean function(const(GRegex)* regex, const(gchar)* string, GRegexMatchFlags match_options, GMatchInfo** match_info); 197 alias da_g_regex_match_all_full = gboolean function(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, GMatchInfo** match_info, GError** error); 198 alias da_g_regex_split_simple = gchar** function(const(gchar)* pattern, const(gchar)* string, GRegexCompileFlags compile_options, GRegexMatchFlags match_options); 199 alias da_g_regex_split = gchar** function(const(GRegex)* regex, const(gchar)* string, GRegexMatchFlags match_options); 200 alias da_g_regex_split_full = gchar** function(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, gint max_tokens, GError** error); 201 alias da_g_regex_replace = gchar* function(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, const(gchar)* replacement, GRegexMatchFlags match_options, GError** error); 202 alias da_g_regex_replace_literal = gchar* function(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, const(gchar)* replacement, GRegexMatchFlags match_options, GError** error); 203 alias da_g_regex_replace_eval = gchar* function(const(GRegex)* regex, const(gchar)* string, gssize string_len, gint start_position, GRegexMatchFlags match_options, GRegexEvalCallback eval, gpointer user_data, GError** error); 204 alias da_g_regex_check_replacement = gboolean function(const(gchar)* replacement, gboolean* has_references, GError** error); 205 alias da_g_match_info_get_regex = GRegex* function(const(GMatchInfo)* match_info); 206 alias da_g_match_info_get_string = const(gchar)* function(const(GMatchInfo)* match_info); 207 alias da_g_match_info_ref = GMatchInfo* function(GMatchInfo* match_info); 208 alias da_g_match_info_unref = void function(GMatchInfo* match_info); 209 alias da_g_match_info_free = void function(GMatchInfo* match_info); 210 alias da_g_match_info_next = gboolean function(GMatchInfo* match_info, GError** error); 211 alias da_g_match_info_matches = gboolean function(const(GMatchInfo)* match_info); 212 alias da_g_match_info_get_match_count = gint function(const(GMatchInfo)* match_info); 213 alias da_g_match_info_is_partial_match = gboolean function(const(GMatchInfo)* match_info); 214 alias da_g_match_info_expand_references = gchar* function(const(GMatchInfo)* match_info, const(gchar)* string_to_expand, GError** error); 215 alias da_g_match_info_fetch = gchar* function(const(GMatchInfo)* match_info, gint match_num); 216 alias da_g_match_info_fetch_pos = gboolean function(const(GMatchInfo)* match_info, gint match_num, gint* start_pos, gint* end_pos); 217 alias da_g_match_info_fetch_named = gchar* function(const(GMatchInfo)* match_info, const(gchar)* name); 218 alias da_g_match_info_fetch_named_pos = gboolean function(const(GMatchInfo)* match_info, const(gchar)* name, gint* start_pos, gint* end_pos); 219 alias da_g_match_info_fetch_all = gchar** function(const(GMatchInfo)* match_info); 220 } 221 222 __gshared 223 { 224 da_g_regex_error_quark g_regex_error_quark; 225 da_g_regex_new g_regex_new; 226 da_g_regex_ref g_regex_ref; 227 da_g_regex_unref g_regex_unref; 228 da_g_regex_get_pattern g_regex_get_pattern; 229 da_g_regex_get_max_backref g_regex_get_max_backref; 230 da_g_regex_get_capture_count g_regex_get_capture_count; 231 da_g_regex_get_has_cr_or_lf g_regex_get_has_cr_or_lf; 232 da_g_regex_get_string_number g_regex_get_string_number; 233 da_g_regex_escape_string g_regex_escape_string; 234 da_g_regex_escape_nul g_regex_escape_nul; 235 da_g_regex_get_compile_flags g_regex_get_compile_flags; 236 da_g_regex_get_match_flags g_regex_get_match_flags; 237 da_g_regex_match_simple g_regex_match_simple; 238 da_g_regex_match g_regex_match; 239 da_g_regex_match_full g_regex_match_full; 240 da_g_regex_match_all g_regex_match_all; 241 da_g_regex_match_all_full g_regex_match_all_full; 242 da_g_regex_split_simple g_regex_split_simple; 243 da_g_regex_split g_regex_split; 244 da_g_regex_split_full g_regex_split_full; 245 da_g_regex_replace g_regex_replace; 246 da_g_regex_replace_literal g_regex_replace_literal; 247 da_g_regex_replace_eval g_regex_replace_eval; 248 da_g_regex_check_replacement g_regex_check_replacement; 249 da_g_match_info_get_regex g_match_info_get_regex; 250 da_g_match_info_get_string g_match_info_get_string; 251 da_g_match_info_ref g_match_info_ref; 252 da_g_match_info_unref g_match_info_unref; 253 da_g_match_info_free g_match_info_free; 254 da_g_match_info_next g_match_info_next; 255 da_g_match_info_matches g_match_info_matches; 256 da_g_match_info_get_match_count g_match_info_get_match_count; 257 da_g_match_info_is_partial_match g_match_info_is_partial_match; 258 da_g_match_info_expand_references g_match_info_expand_references; 259 da_g_match_info_fetch g_match_info_fetch; 260 da_g_match_info_fetch_pos g_match_info_fetch_pos; 261 da_g_match_info_fetch_named g_match_info_fetch_named; 262 da_g_match_info_fetch_named_pos g_match_info_fetch_named_pos; 263 da_g_match_info_fetch_all g_match_info_fetch_all; 264 } 265 }